<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="com.blockchain.console.servlets.financial.AbstractFinancialServlet"%>
<%@page import="com.blockchain.console.servlets.financial.tx.TxglView"%>
<%@page import="com.blockchain.console.servlets.financial.tx.Shsb"%>
<%@page import="com.blockchain.console.servlets.financial.tx.Txcg"%>
<%@page import="com.blockchain.console.servlets.financial.tx.Shtg"%>
<%@page import="com.blockchain.console.servlets.financial.tx.TxglList"%>
<%@page import="com.blockchain.console.servlets.financial.tx.ExportTxsb"%>
<%@page import="com.blockchain.console.servlets.financial.tx.Txsb"%>
<%@page import="com.blockchain.console.service.financial.entity.TxglRecord"%>
<%@page import="com.blockchain.console.service.system.entity.Bank"%>
<%@page import="com.blockchain.common.enums.IsPass"%>
<%@page import="com.blockchain.common.enums.WithdrawStatus"%>
<%@page import="java.math.BigDecimal"%>
<%@page import="java.text.DecimalFormat"%>
<html>
<head>
<%@include file="/WEB-INF/include/meta.jsp"%>
<%@include file="/WEB-INF/include/style.jsp"%>
<%@include file="/WEB-INF/include/datepicker.jsp"%>
<style type="text/css">
	.yhgl_inputtext{ background:#fff; border:1px #d7dfe3 solid; height:23px; line-height:23px; width:175px;}
</style>
</head>
<%
	Bank[] banks=ObjectHelper.convertArray(request.getAttribute("banks"), Bank.class);
	PagingResult<TxglRecord> result = (PagingResult<TxglRecord>) request.getAttribute("result");
	int bankId=IntegerParser.parse(request.getParameter("bankId"));
	BigDecimal totalAmount=new BigDecimal(0);
	BigDecimal totalFee=new BigDecimal(0);
%>
<%
		CURRENT_CATEGORY = "CWGL";
			CURRENT_SUB_CATEGORY = "TXGL";
	%>
<body>
	<%@include file="/WEB-INF/include/header.jsp"%>
	<div class="w_main">
		<div class="main clearfix">
			<div class="wrap">
				<div class="r_main">
				<form action="<%=controller.getURI(request, Txsb.class)%>" name="form1" method="post" id="searchForm">
					<div class="home_main">
						<div class="box box1 mb15">
							<div class="atil">
								<h3>提现管理</h3>
							</div>
						</div>
						<div class="box box1 mb15">
							<div class="con">
								<div class="admin_input admin_pb">
             						<div class="table top3">
             							<p>	
											<span>流水号:</span>
											<input type="text" class="yhgl_inputtext" name="lsh" value="<%StringHelper.filterQuoter(out, request.getParameter("lsh"));%>" />
										</p>
										<P>
											<span>用户名:</span>
											<input type="text" class="yhgl_inputtext" name="yhm" value="<%StringHelper.filterQuoter(out, request.getParameter("yhm"));%>" />
										</P>
										<P>
											<span>姓名:</span>
											<input type="text" class="yhgl_inputtext" name="xm" value="<%StringHelper.filterQuoter(out, request.getParameter("xm"));%>" />
										</P>
										<P>
											<span>银行卡号:</span>
											<input type="text" class="yhgl_inputtext" name="yhkh" value="<%StringHelper.filterQuoter(out, request.getParameter("yhkh"));%>" />
										</P>
										<P>
											<span>提现银行：</span>
											<select name="bankId" class="selt yhgl_sel" style="width: 100px" >
												<option value="">请选择</option>
												<%
													for (Bank bank : banks) {
														if (bank == null) {
															continue;
														}
												%>
												<option value="<%=bank.id%>" <%if (bank.id == bankId) {%> selected="selected" <%}%>>
												<%StringHelper.filterHTML(out, bank.name);%>
												</option>
												<%
													}
												%>
											</select>
										</P>
										<P>
											<span>提现审核时间：</span>
											<input type="text" name="startExtractonTime" id="datepicker1" readonly="readonly" class="yhgl_input date" />至
											<input type="text" name="endExtractionTime" id="datepicker2" readonly="readonly" class="yhgl_input date" />
										</P>
										<div class="mr10">
											<input name="search" type="submit" class="btn2 mr10" value="搜索" />
																			<%
										if (blockchainSession.isAccessableResource(ExportTxsb.class)) {
											%>
											<a href="javascript:void(0)" onclick="showExport()" class="btn3 mr10"><span class="ico"></span>导出</a>
											<%}else{ %>
											<span class="btn3 btn5 mr10"><span class="ico"></span>导出</span>
									<%} %> 
										</div>
								<div class="clear"></div>
							</div>
							</div>
							</div>
						</div>
						<div class="newsbox">
							<div class="til clearfix">
								<div class="Menubox">
									<ul>
										<li id="one1"><a href="<%=controller.getURI(request, TxglList.class)%>">未审核</a></li>
										<li id="one2"><a href="<%=controller.getURI(request, Shtg.class)%>">审核通过</a></li>
										<li id="one3"><a href="<%=controller.getURI(request, Txcg.class)%>">已提现</a></li>
										<li id="one4"><a href="<%=controller.getURI(request, Shsb.class)%>">审核不通过</a></li>
										<li id="one5" style="border-right: 1px #d7dfe3 solid;"  class="hover">提现失败</li>
									</ul>
								</div>
								<div class="clear"></div>
								<div class="border p15 Men_bt no_table" id="con_one_1">
									<table width="100%" border="0" cellspacing="0" cellpadding="0" class="yhgl_table tc">
										<tr class="hsbg">
											<td>流水号</td>
											<td align="center">用户名</td>
											<td align="center">姓名/手机号</td>
											<td align="center">提现银行</td>
											<td align="center">所在地</td>
											<td align="center">所在城市</td>
											<td align="center">所在支行</td>
											<td align="center">银行卡号</td>
											<td align="center">提现金额(USDZ)</td>
											<td align="center">手续费(USDZ)</td>
											<td align="center">实际到账(USDZ)</td>
											<td align="center">实际到账(CNY)</td>
											<td align="center">申请时间</td>
											<td align="center">提现审核时间</td>
											<td align="center">操作人</td>
											<td align="center">操作</td>
										</tr>
										<%
										TxglRecord[] txglRecords = result.getItems();
											if (txglRecords != null&&txglRecords.length>0) {
												for (TxglRecord txglItem : txglRecords) {
													if (txglItem == null) {
														continue;
													}
													totalAmount=totalAmount.add(txglItem.extractionAmount);
													totalFee=totalFee.add(txglItem.charge);
									    %>
										<tr class="dhsbg">
											<td><%=txglItem.id%></td>
											<td>  	<%
												StringHelper.filterHTML(out, txglItem.loginName);
											%>
											</td>
											<td>
											<%
												StringHelper.filterHTML(out, txglItem.userName);
											%><br/>
												<%=txglItem.phoneNumber%>
											</td>
											<td>
												<%
												StringHelper.filterHTML(out,
																		txglItem.extractionBank);
											%>
											</td>
											<td>
												<%
												StringHelper.filterHTML(out, txglItem.location);
											%>
											</td>
											<td>
												<%
													StringHelper.filterHTML(out, txglItem.cs);
												%>
											</td>
											<td>
												<%
												StringHelper.filterHTML(out, txglItem.subbranch);
											%>
											</td>
											<td>
												<%
												StringHelper.filterHTML(out, txglItem.bankId);
											%>
											</td>
											<td><%=Formater.formatAmount(txglItem.extractionAmount.add(txglItem.charge))%></td>
											<td><%=txglItem.charge%></td>
											<td><%=Formater.formatAmount(txglItem.extractionAmount)%></td>
											<td><%=Formater.formatAmount(txglItem.rate.multiply(txglItem.extractionAmount).setScale(2,BigDecimal.ROUND_DOWN))%></td>
											<td><%=DateTimeParser.format(txglItem.createTime,"yyyy-MM-dd HH:mm")%></td>
											<td><%=DateTimeParser.format(txglItem.applyDateTime,"yyyy-MM-dd HH:mm")%></td>
											<td><%StringHelper.filterHTML(out, txglItem.approver); %></td>
											<td align="center" class="blue">
											<%
											if (blockchainSession.isAccessableResource(TxglView.class)) {
											%>
											<a href="<%=controller.getURI(request,TxglView.class)%>?id=<%=txglItem.id%>">查看原因</a>
											<%}else{ %>
											<span class="gray6">查看原因</span>
											<%} %> 
											</td>
										</tr>
										<%
												}
											}else{
									    %>
									    <tr><td colspan="14" align="center">没有记录</td></tr>
									    <%} %>
									    <tr>
									    	<td colspan="14" align="left"><span style="padding-top: 5px">
										    	总计：提现金额 <span style="color: red;"><%=Formater.formatAmount(totalAmount) %></span>,
												手续费<span style="color: red;"><%=Formater.formatAmount(totalFee) %></span>,
												共<span style="color: red;"><%=txglRecords!=null?txglRecords.length:0 %></span>笔</span>
											</td>
									</tr>
									</table>
									
									<%AbstractFinancialServlet.rendPagingResult(out, result);%>
								</div>
							</div>
							<div class="clear"></div>
						</div>
						<div class="box2 clearfix"></div>
					</div>
					</form>
				</div>
			</div>
			<%@include file="/WEB-INF/include/left.jsp"%>
		</div>
	</div>
	<%@include file="/WEB-INF/include/footer.jsp"%>
	<%@include file="/WEB-INF/include/script.jsp"%>
	<script type="text/javascript" src="<%=controller.getStaticPath(request)%>/js/txgl/withdrawals.js"></script>
	<%@include file="/WEB-INF/include/datepicker.jsp"%>
	<script type="text/javascript">
	$(function() {
		$("#datepicker1").datepicker({inline: true});
	    $('#datepicker1').datepicker('option', {dateFormat:'yy-mm-dd'});
	    $("#datepicker2").datepicker({inline: true});
	    $('#datepicker2').datepicker('option', {dateFormat:'yy-mm-dd'});
	    $("#datepicker1").datepicker("setDate", "<%StringHelper.filterHTML(out, request.getParameter("startExtractonTime"));%>");
	    $("#datepicker2").datepicker("setDate", "<%StringHelper.filterHTML(out, request.getParameter("endExtractionTime"));%>");
	});
	function showExport()
	{
		document.getElementById("searchForm").action ="<%=controller.getURI(request, ExportTxsb.class)%>";
		$("#searchForm").submit();
		document.getElementById("searchForm").action ="<%=controller.getURI(request, Txsb.class)%>";
	}
	</script>
</body>
</html>